package cn.usts.edu.lesson06;

import javax.swing.*;
import java.awt.*;

public class JComboBoxDemo extends JFrame {
    public JComboBoxDemo() {
        this.setTitle("下拉框");
        this.setBounds(100,100,500,500);
        this.setVisible(true);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        JComboBox<Object> comboBox = new JComboBox<>();
        comboBox.addItem(null);
        comboBox.addItem("Python");
        comboBox.addItem("Java");
        comboBox.addItem("C");
        comboBox.addItem("C++");

        Container container = this.getContentPane();
        container.add(comboBox,BorderLayout.NORTH);
    }

    public static void main(String[] args) {
        new JComboBoxDemo();
    }
}
